/*
 * @Description:
 * @Author: liyuhao
 * @Date: 2022-06-08 10:50:06
 * @LastEditors: liyuhao
 * @LastEditTime: 2022-06-08 16:52:41
 */
import React, { useState } from 'react';
import Time from '@/components/Time';
import './DpLayout.less';
import { useNavigate } from 'react-router-dom';
import Screen from '@/pages/screen';

const DapingLayout: React.FC = (props) => {
  const { children } = props;
  const [menuIndex, setNenuIndex] = useState(0);
  const navigate = useNavigate();
  const isHref = (val: string) => {
    return window.location.href.indexOf(val) != -1;
  };
  const menu = [
    { name: '综合首页', path: '/index', float: 'float-left',element:<Screen/> },
    { name: '全域客流', path: '/tourist', float: 'float-left' },
    { name: '景区监测', path: '/scenic', float: 'float-left' },
    { name: '视频监控', path: '/video', float: 'float-right' },
    { name: '合同分析', path: '/contract', float: 'float-right' },
    { name: '团队专题', path: '/team', float: 'float-right' },
  ];
  return (
    <div className={'da-ping-layout'}>
      <div
        className={'page-title-btn'}
        onClick={() => {
          window.location.href =
            '/map/scenic';
        }}
      ></div>

      <div className={'layout-top'}>123</div>
      <div className=" top_menu_box w-full">
        {menu.map((item, index) => (
          <div
            key={index}
            className={`${isHref(item.path) ? 'active' : ''} ${item.float}`}
            onClick={() => setNenuIndex(index)}
          >
            <div onClick={()=>{navigate(item.path)}}>{item.name}</div>
          </div>
        ))}
      </div>
      {/*<Time className={styles['layout-time']} />*/}
      {children}
    </div>
  );
};

export default DapingLayout;
